<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="../css/layui.css" rel="stylesheet">
<script type="text/javascript" src="../layui.all.js"></script>
		<title>...</title>
	
	</head>
	<body>
	<body class="childrenBody">
<form class="layui-form changePwd">
	<input type="hidden" name="type" value="1" />
    <input type="hidden" name="id"  id="id" value="${model.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">登录名</label>
        <div class="layui-input-block">
            <input type="text" name="userName" value="${model.userName }" id="userName"  lay-verify="required|userName" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="pwd" value="${model.pwd }"   id="pwd" lay-verify="required|pwd" class="layui-input ">
        </div>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="realName" value="${model.realName }" id="realName"  lay-verify="required|realName" class="layui-input ">
        </div>
    </div>
    
    
    <div class="layui-form-item proSelect">
         <label class="layui-form-label">所属组别</label>
          <div class="layui-input-block editWidth">
              <select name="groupId" lay-verify="required" id="groupId">
              </select>
          </div>
     </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="*">保存</button>
            <button type="button" class="layui-btn layui-btn-primary" onclick="parent.close();">关闭</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="../js/common/jquery.min.js"></script>
<script>
var form;
    $(function(){
    	
    	
    	
    	layui.use(['form','layer' ], function() {
            form = layui.form;
            var layer = layui.layer;
            // 添加验证规则
            /* form.verify({
                name : function(value, item) {
                    value = value.trim();
                    if (value.length < 0) {
                        return "请输入教师名称";
                    }
                }
            }); */

            form.on('submit(*)', function(data) {
                var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
                var d = data.field;
                var url = "/web_seach/user/save";
                $.ajax({
                    url: url,
                    data:d,
                    dataType:"text",
                    success: function(data){
                        layer.close(index);
                        if(data == 0){
                            layer.msg("保存成功！");
                            parent.queryTea();
                            parent.close();
                        }else{
                            layer.msg("保存失败！");
                        }
                    },error:function(){
                        layer.close(index);
                        layer.msg("保存失败！");
                    }
                });
                return false;
            });
        });
    	
    	
    	
    	var groupId='${model.groupId}';
		var url = "/web_seach/group/getGroupHtml?id="+groupId;
    	
        $.ajax({
            url: url,
            
            success: function(data){
            	$("#groupId").html(data);
            	form.render();
            }
        });
    })

    

</script>
</body>

</body>


</html>
